package com.shujia.java.day6.OOP1;

public class Person {
    //属性
    private String name;//姓名
    private int age;

    //每一个类都有构造方法
    public Person() {
    }

    //构造方法
    public Person(String name) {
        this.name = name;
    }

    //构造方法
    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    //getset方法 获得名字
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void print() {
        System.out.println(name +" "+ age);
    }
}
